93

Merging Sheets

93

Once the button is created, you can assign the macro using a right mouse click as

shown in Figure 6.3:

FIGURE 6.3  Macro assignment.

STEP 1—​Initialize

Public Declare PtrSafe Function GetKeyboardState Lib “user32” (pbKeyState As Byte)

As Long

Public Declare PtrSafe Function GetAsyncKeyState Lib “User32.dll” (ByVal vKey As

Long) As Long

Public FirstTime As String

Public CurrentWorkbookName As String

Public ii As Double, kk As D18ouble, wb As Workbook, ws As Worksheet, jj As

Double, NoData As Integer, B As String

Public FirstRow, FirstColumn, MandatoryColumn, TraceColumn, RowMax, ColMax

As Integer

Public OverallTime As Double

Public fileopenWb As Workbook, thisWb As Workbook

Public fileopenTargetWb, parentWb As Workbook

Public fileopenTargetWs As Worksheet, parentWs, thisWs As Worksheet

Sub ExcelFileMerge()